package com.slz3.business.module.memberManagement.memRaffleTicket.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memRaffleTicket.domain.MemRaffleTicket;
import com.slz3.business.module.memberManagement.memRaffleTicket.domain.MemRaffleTicketFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemRaffleTicketTransactionalServiceImpl implements MemRaffleTicketTransactionalService {

    @Override
    public MemRaffleTicket modify(MemRaffleTicket memRaffleTicketNew) {
        Repositorys.memRaffleTicket.test();
        Repositorys.memRaffleTicket.save(MemRaffleTicketFactory.initBaseFields());
        System.err.println(1/0);
        memRaffleTicketNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memRaffleTicket.saveAndFlush(memRaffleTicketNew);
    }

    @Override
    public List<MemRaffleTicket> batchModify(List<MemRaffleTicket> memRaffleTicketList) {
        return Repositorys.memRaffleTicket.saveAll(memRaffleTicketList);
    }
}
